package com.navinfo.tripanalysis.offline.util;

import com.navinfo.tripanalysis.common.arithmetic.common.InterRangeData;
import com.navinfo.tripanalysis.common.arithmetic.common.OutStatisticsRangeData.RangeAcceleratedSpeedStatisticsData;
import com.navinfo.tripanalysis.common.arithmetic.common.OutStatisticsRangeData.RangeDiffGasOpenPercentStatisticsData;
import com.navinfo.tripanalysis.common.arithmetic.common.OutStatisticsRangeData.RangeDrivingSlopeStatisticsData;
import com.navinfo.tripanalysis.common.arithmetic.common.OuterStatisticData;

import java.math.BigDecimal;
import java.util.Map;
import java.util.Optional;

/**
 * 行程各项统计指标的精准工具
 **/
public class TripStatisticFixUtils {

    /**
     * 计算行程各项统计指标的精准值<br/>
     * 通过精准后的里程油耗时长和积分里程油耗时长，精准各项统计指标
     */
    public static void fixTrips(OuterStatisticData statisticData) {
        //积分里程、油耗、时长
        int totalMileage0 = statisticData.getRouteIntegralMileage();
        int totalFuel0 = statisticData.getRouteIntegralFuel();
        int totalDuration0 = statisticData.getRouteIntegralDuration();

        //精准里程、油耗、时长
        int totalMileage = statisticData.getTripMileage();
        int totalFuel = statisticData.getTripFuel();
        int totalDuration = statisticData.getTripDuration();


        //精准后的数组
        Integer[] ints;
        /*--start_schema*/
        //在挡滑行里程 单位:M
        statisticData.setInGearCoastMileage(fixSingleData(totalMileage0, totalMileage, statisticData.getInGearCoastMileage()));
        //在挡滑行时长 单位：秒
        statisticData.setInGearCoastDuration(fixSingleData(totalDuration0, totalDuration, statisticData.getInGearCoastDuration()));

        //空挡滑行里程 单位:M
        statisticData.setNeutralGearCoastMileage(fixSingleData(totalMileage0,totalMileage, statisticData.getNeutralGearCoastMileage()));
        //空挡滑行油耗 单位:ML
        statisticData.setNeutralGearCoastFuel(fixSingleData(totalFuel0,totalFuel, statisticData.getNeutralGearCoastFuel()));
        //空挡滑行时长 单位：秒
        statisticData.setNeutralGearCoastDuration(fixSingleData(totalDuration0,totalDuration, statisticData.getNeutralGearCoastDuration()));

        //制动里程 单位:M
        statisticData.setBrakeMileage(fixSingleData(totalMileage0,totalMileage, statisticData.getBrakeMileage()));
        //制动时长 单位:S
        statisticData.setBrakeDuration(fixSingleData(totalDuration0,totalDuration, statisticData.getBrakeDuration()));

        //怠速油耗 单位:ML
        statisticData.setIdleFuel(fixSingleData(totalFuel0,totalFuel, statisticData.getIdleFuel()));
        //怠速时长 单位:S
        statisticData.setIdleDuration(fixSingleData(totalDuration0,totalDuration, statisticData.getIdleDuration()));

        //停车通电时长 单位:S
        statisticData.setParkingPowerOnDuration(fixSingleData(totalDuration0,totalDuration, statisticData.getParkingPowerOnDuration()));

        //城市非城市里程 单位M
        ints = fixArrayData(totalMileage, new Integer[]{statisticData.getCityDrivingMileage(), statisticData.getRuralDrivingMileage()});
        statisticData.setCityDrivingMileage(ints[0]);
        statisticData.setRuralDrivingMileage(ints[1]);
        //城市非城市油耗  单位:ML
        ints = fixArrayData(totalFuel, new Integer[]{statisticData.getCityDrivingFuel(),statisticData.getRuralDrivingFuel()});
        statisticData.setCityDrivingFuel(ints[0]);
        statisticData.setRuralDrivingFuel(ints[1]);
        //城市非城市时长 单位:S
        ints = fixArrayData(totalDuration, new Integer[]{statisticData.getCityDrivingDuration(),statisticData.getRuralDrivingDuration()});
        statisticData.setCityDrivingDuration(ints[0]);
        statisticData.setRuralDrivingDuration(ints[1]);

        //经济行驶里程 单位:M
        statisticData.setEcoDrivingMileage(fixSingleData(totalMileage0,totalMileage, statisticData.getEcoDrivingMileage()));
        //经济行驶油耗 单位:ML
        statisticData.setEcoDrivingFuel(fixSingleData(totalFuel0,totalFuel, statisticData.getEcoDrivingFuel()));
        //经济行驶时长 单位:S
        statisticData.setEcoDrivingDuration(fixSingleData(totalDuration0,totalDuration, statisticData.getEcoDrivingDuration()));

        //上坡下坡平路里程 单位:M
        ints = fixArrayData(totalMileage, new Integer[]{statisticData.getUpSlopeDrivingMileage(), statisticData.getDownSlopeDrivingMileage(),statisticData.getLevelRoadDrivingMileage()});
        statisticData.setUpSlopeDrivingMileage(ints[0]);
        statisticData.setDownSlopeDrivingMileage(ints[1]);
        statisticData.setLevelRoadDrivingMileage(ints[2]);
        //上坡下坡平路油耗 单位:ML
        ints = fixArrayData(totalFuel, new Integer[]{ statisticData.getUpSlopeDrivingFuel(),statisticData.getDownSlopeDrivingFuel(), statisticData.getLevelRoadDrivingFuel()});
        statisticData.setUpSlopeDrivingFuel(ints[0]);
        statisticData.setDownSlopeDrivingFuel(ints[1]);
        statisticData.setLevelRoadDrivingFuel(ints[2]);
        //上坡下坡平路时长 单位:S
        ints = fixArrayData(totalDuration, new Integer[]{ statisticData.getUpSlopeDrivingDuration(), statisticData.getDownSlopeDrivingDuration(),statisticData.getLevelRoadDrivingDuration()});
        statisticData.setUpSlopeDrivingDuration(ints[0]);
        statisticData.setDownSlopeDrivingDuration(ints[1]);
        statisticData.setLevelRoadDrivingDuration(ints[2]);

        //巡航里程(定速巡航距离) 单位:M
        statisticData.setCruiseMileage(fixSingleData(totalMileage0,totalMileage, statisticData.getCruiseMileage()));
        //定速巡航油量 单位:ML
        statisticData.setCruiseFuel(fixSingleData(totalFuel0,totalFuel, statisticData.getCruiseFuel()));
        //定速巡航时长 单位:S
        statisticData.setCruiseDuration(fixSingleData(totalDuration0,totalDuration, statisticData.getCruiseDuration()));

        //激烈减速时长 单位: S
        statisticData.setSharpDownSpeedDuration(fixSingleData(totalDuration0,totalDuration, statisticData.getSharpDownSpeedDuration()));
        //激烈减速距离 单位:M
        statisticData.setSharpDownSpeedMileage(fixSingleData(totalMileage0,totalMileage, statisticData.getSharpDownSpeedMileage()));

        //激烈加速距离 单位:M
        statisticData.setSharpUpSpeedMileage(fixSingleData(totalMileage0,totalMileage, statisticData.getSharpUpSpeedMileage()));
        //激烈加速油耗 单位:ML
        statisticData.setSharpUpSpeedFuel(fixSingleData(totalFuel0,totalFuel, statisticData.getSharpUpSpeedFuel()));
        //激烈加速时长 单位: S
        statisticData.setSharpUpSpeedDuration(fixSingleData(totalDuration0,totalDuration, statisticData.getSharpUpSpeedDuration()));


        //急踩油门行驶距离 单位:M
        statisticData.setSharpStepOnGasMileage(fixSingleData(totalMileage0,totalMileage, statisticData.getSharpStepOnGasMileage()));
        //急踩油门时长 单位: S
        statisticData.setSharpStepOnGasDuration(fixSingleData(totalDuration0,totalDuration, statisticData.getSharpStepOnGasDuration()));
        //急踩油门油量 单位:ML
        statisticData.setSharpStepOnGasFuel(fixSingleData(totalFuel0,totalFuel, statisticData.getSharpStepOnGasFuel()));

        //车辆起步累计里程 单位:M
        statisticData.setVehicleStartMileage(fixSingleData(totalMileage0,totalMileage, statisticData.getVehicleStartMileage()));
        //车辆起步时长 单位: S
        statisticData.setVehicleStartDuration(fixSingleData(totalDuration0,totalDuration, statisticData.getVehicleStartDuration()));
        //车辆起步耗油量 单位:ML
        statisticData.setVehicleStartFuel(fixSingleData(totalFuel0,totalFuel, statisticData.getVehicleStartFuel()));

        //冷车起步累计里程 单位:M
        statisticData.setVehicleColdStartMileage(fixSingleData(totalMileage0,totalMileage, statisticData.getVehicleColdStartMileage()));
        //冷车起步时长 单位: S
        statisticData.setVehicleColdStartDuration(fixSingleData(totalDuration0,totalDuration, statisticData.getVehicleColdStartDuration()));
        //冷车起步耗油量 单位:ML
        statisticData.setVehicleColdStartFuel(fixSingleData(totalFuel0,totalFuel, statisticData.getVehicleColdStartFuel()));


        //加油数量 单位:ML
        statisticData.setChargeFuel(fixSingleData(totalFuel0, totalFuel, statisticData.getChargeFuel()));

        //漏油数量 单位:ML
        statisticData.setLeakFuel(fixSingleData(totalFuel0,totalFuel, statisticData.getLeakFuel()));

        //油门稳定性时长 单位:S
        statisticData.setGasStabilityDuration(fixSingleData(totalDuration0,totalDuration, statisticData.getGasStabilityDuration()));
        //speed mileage
        ints = fixArrayData(totalMileage, new Integer[]{
                statisticData.getSpeedRange01Mileage(),
                statisticData.getSpeedRange02Mileage(),
                statisticData.getSpeedRange03Mileage(),
                statisticData.getSpeedRange04Mileage(),
                statisticData.getSpeedRange05Mileage(),
                statisticData.getSpeedRange06Mileage(),
                statisticData.getSpeedRange07Mileage(),
                statisticData.getSpeedRange08Mileage(),
                statisticData.getSpeedRange09Mileage(),
                statisticData.getSpeedRange10Mileage(),
                statisticData.getSpeedRange11Mileage(),
                statisticData.getSpeedRange12Mileage(),
                statisticData.getExceedSpeedRangeMileage()
        });
        statisticData.setSpeedRange01Mileage(ints[0]);
        statisticData.setSpeedRange02Mileage(ints[1]);
        statisticData.setSpeedRange03Mileage(ints[2]);
        statisticData.setSpeedRange04Mileage(ints[3]);
        statisticData.setSpeedRange05Mileage(ints[4]);
        statisticData.setSpeedRange06Mileage(ints[5]);
        statisticData.setSpeedRange07Mileage(ints[6]);
        statisticData.setSpeedRange08Mileage(ints[7]);
        statisticData.setSpeedRange09Mileage(ints[8]);
        statisticData.setSpeedRange10Mileage(ints[9]);
        statisticData.setSpeedRange11Mileage(ints[10]);
        statisticData.setSpeedRange12Mileage(ints[11]);
        statisticData.setExceedSpeedRangeMileage(ints[12]);
        //speed duration
        ints = fixArrayData(totalDuration, new Integer[]{
                statisticData.getSpeedRange01Duration(),
                statisticData.getSpeedRange02Duration(),
                statisticData.getSpeedRange03Duration(),
                statisticData.getSpeedRange04Duration(),
                statisticData.getSpeedRange05Duration(),
                statisticData.getSpeedRange06Duration(),
                statisticData.getSpeedRange07Duration(),
                statisticData.getSpeedRange08Duration(),
                statisticData.getSpeedRange09Duration(),
                statisticData.getSpeedRange10Duration(),
                statisticData.getSpeedRange11Duration(),
                statisticData.getSpeedRange12Duration(),
                statisticData.getExceedSpeedRangeDuration()
        });
        statisticData.setSpeedRange01Duration(ints[0]);
        statisticData.setSpeedRange02Duration(ints[1]);
        statisticData.setSpeedRange03Duration(ints[2]);
        statisticData.setSpeedRange04Duration(ints[3]);
        statisticData.setSpeedRange05Duration(ints[4]);
        statisticData.setSpeedRange06Duration(ints[5]);
        statisticData.setSpeedRange07Duration(ints[6]);
        statisticData.setSpeedRange08Duration(ints[7]);
        statisticData.setSpeedRange09Duration(ints[8]);
        statisticData.setSpeedRange10Duration(ints[9]);
        statisticData.setSpeedRange11Duration(ints[10]);
        statisticData.setSpeedRange12Duration(ints[11]);
        statisticData.setExceedSpeedRangeDuration(ints[12]);
        //speed fuel
        ints = fixArrayData(totalFuel, new Integer[]{
                statisticData.getSpeedRange01Fuel(),
                statisticData.getSpeedRange02Fuel(),
                statisticData.getSpeedRange03Fuel(),
                statisticData.getSpeedRange04Fuel(),
                statisticData.getSpeedRange05Fuel(),
                statisticData.getSpeedRange06Fuel(),
                statisticData.getSpeedRange07Fuel(),
                statisticData.getSpeedRange08Fuel(),
                statisticData.getSpeedRange09Fuel(),
                statisticData.getSpeedRange10Fuel(),
                statisticData.getSpeedRange11Fuel(),
                statisticData.getSpeedRange12Fuel(),
                statisticData.getExceedSpeedRangeFuel()
        });
        statisticData.setSpeedRange01Fuel(ints[0]);
        statisticData.setSpeedRange02Fuel(ints[1]);
        statisticData.setSpeedRange03Fuel(ints[2]);
        statisticData.setSpeedRange04Fuel(ints[3]);
        statisticData.setSpeedRange05Fuel(ints[4]);
        statisticData.setSpeedRange06Fuel(ints[5]);
        statisticData.setSpeedRange07Fuel(ints[6]);
        statisticData.setSpeedRange08Fuel(ints[7]);
        statisticData.setSpeedRange09Fuel(ints[8]);
        statisticData.setSpeedRange10Fuel(ints[9]);
        statisticData.setSpeedRange11Fuel(ints[10]);
        statisticData.setSpeedRange12Fuel(ints[11]);
        statisticData.setExceedSpeedRangeFuel(ints[12]);

        //speed 带档滑行里程，使用行程带档滑行里程精准，保证各速度区间带档滑行里程之和与行程总带档滑行里程一致
        int totalGearMileage0 = Optional.ofNullable(statisticData.getSpeedRange01GearMileage()).orElse(0)
                +	Optional.ofNullable(statisticData.getSpeedRange02GearMileage()).orElse(0)
                +	Optional.ofNullable(statisticData.getSpeedRange03GearMileage()).orElse(0)
                +	Optional.ofNullable(statisticData.getSpeedRange04GearMileage()).orElse(0)
                +	Optional.ofNullable(statisticData.getSpeedRange05GearMileage()).orElse(0)
                +	Optional.ofNullable(statisticData.getSpeedRange06GearMileage()).orElse(0)
                +	Optional.ofNullable(statisticData.getSpeedRange07GearMileage()).orElse(0)
                +	Optional.ofNullable(statisticData.getSpeedRange08GearMileage()).orElse(0)
                +	Optional.ofNullable(statisticData.getSpeedRange09GearMileage()).orElse(0)
                +	Optional.ofNullable(statisticData.getSpeedRange10GearMileage()).orElse(0)
                +	Optional.ofNullable(statisticData.getSpeedRange11GearMileage()).orElse(0)
                +	Optional.ofNullable(statisticData.getSpeedRange12GearMileage()).orElse(0)
                +	Optional.ofNullable(statisticData.getExceedSpeedRangeGearMileage()).orElse(0);
        int totalGearMileage = Optional.ofNullable(statisticData.getInGearCoastMileage()).orElse(0);
        statisticData.setSpeedRange01GearMileage(fixSingleData(totalGearMileage0,totalGearMileage,statisticData.getSpeedRange01GearMileage()));
        statisticData.setSpeedRange02GearMileage(fixSingleData(totalGearMileage0,totalGearMileage,statisticData.getSpeedRange02GearMileage()));
        statisticData.setSpeedRange03GearMileage(fixSingleData(totalGearMileage0,totalGearMileage,statisticData.getSpeedRange03GearMileage()));
        statisticData.setSpeedRange04GearMileage(fixSingleData(totalGearMileage0,totalGearMileage,statisticData.getSpeedRange04GearMileage()));
        statisticData.setSpeedRange05GearMileage(fixSingleData(totalGearMileage0,totalGearMileage,statisticData.getSpeedRange05GearMileage()));
        statisticData.setSpeedRange06GearMileage(fixSingleData(totalGearMileage0,totalGearMileage,statisticData.getSpeedRange06GearMileage()));
        statisticData.setSpeedRange07GearMileage(fixSingleData(totalGearMileage0,totalGearMileage,statisticData.getSpeedRange07GearMileage()));
        statisticData.setSpeedRange08GearMileage(fixSingleData(totalGearMileage0,totalGearMileage,statisticData.getSpeedRange08GearMileage()));
        statisticData.setSpeedRange09GearMileage(fixSingleData(totalGearMileage0,totalGearMileage,statisticData.getSpeedRange09GearMileage()));
        statisticData.setSpeedRange10GearMileage(fixSingleData(totalGearMileage0,totalGearMileage,statisticData.getSpeedRange10GearMileage()));
        statisticData.setSpeedRange11GearMileage(fixSingleData(totalGearMileage0,totalGearMileage,statisticData.getSpeedRange11GearMileage()));
        statisticData.setSpeedRange12GearMileage(fixSingleData(totalGearMileage0,totalGearMileage,statisticData.getSpeedRange12GearMileage()));
        statisticData.setExceedSpeedRangeGearMileage(fixSingleData(totalGearMileage0,totalGearMileage,statisticData.getExceedSpeedRangeGearMileage()));

        //辅助制动里程 单位:M
        statisticData.setAssistBrakeMileage(fixSingleData(totalMileage0,totalMileage, statisticData.getAssistBrakeMileage()));
        //辅助制动时长 单位:S
        statisticData.setAssistBrakeDuration(fixSingleData(totalDuration0,totalDuration, statisticData.getAssistBrakeDuration()));

        //停车轰油门时长 单位:S
        statisticData.setParkThrottleDuration(fixSingleData(totalDuration0,totalDuration, statisticData.getParkThrottleDuration()));
        //停车轰油门油耗 单位:ML
        statisticData.setParkThrottleFuel(fixSingleData(totalFuel0,totalFuel, statisticData.getParkThrottleFuel()));

        //行驶过程中手刹使用时长 单位:S
        statisticData.setDrivingHandbrakeDuration(fixSingleData(totalDuration0,totalDuration, statisticData.getDrivingHandbrakeDuration()));
        //行驶过程中手刹使用里程 单位:M
        statisticData.setDrivingHandbrakeMileage(fixSingleData(totalMileage0,totalMileage, statisticData.getDrivingHandbrakeMileage()));

        //怠速状态下手刹使用时长 单位:S
        statisticData.setIdleHandbrakeDuration(fixSingleData(totalDuration0,totalDuration, statisticData.getIdleHandbrakeDuration()));

        //水温区间
        ints = fixArrayData(totalDuration, new Integer[]{
                statisticData.getWorkWaterTemp50Duration(),
                statisticData.getWorkWaterTemp70Duration(),
                statisticData.getWorkWaterTemp80Duration(),
                statisticData.getWorkWaterTemp85Duration(),
                statisticData.getWorkWaterTemp90Duration(),
                statisticData.getWorkWaterTemp95Duration(),
                statisticData.getWorkWaterTemp100Duration(),
                statisticData.getWorkWaterTemp105Duration(),
                statisticData.getWorkWaterTemp110Duration(),
                statisticData.getWorkWaterTemp115Duration(),
                statisticData.getWorkWaterTemp120Duration(),
                statisticData.getWorkWaterTemp125Duration(),
                statisticData.getWorkWaterTemp130Duration(),
                statisticData.getWorkWaterTemp135Duration(),
                statisticData.getWorkWaterTemp140Duration(),
                statisticData.getWorkWaterTemp145Duration(),
                statisticData.getWorkWaterTemp150Duration(),
                statisticData.getWorkWaterTempOver150Duration(),
                statisticData.getIdleWaterTemp50Duration(),
                statisticData.getIdleWaterTemp70Duration(),
                statisticData.getIdleWaterTemp80Duration(),
                statisticData.getIdleWaterTemp85Duration(),
                statisticData.getIdleWaterTemp90Duration(),
                statisticData.getIdleWaterTemp95Duration(),
                statisticData.getIdleWaterTemp100Duration(),
                statisticData.getIdleWaterTemp105Duration(),
                statisticData.getIdleWaterTemp110Duration(),
                statisticData.getIdleWaterTemp115Duration(),
                statisticData.getIdleWaterTemp120Duration(),
                statisticData.getIdleWaterTemp125Duration(),
                statisticData.getIdleWaterTemp130Duration(),
                statisticData.getIdleWaterTemp135Duration(),
                statisticData.getIdleWaterTemp140Duration(),
                statisticData.getIdleWaterTemp145Duration(),
                statisticData.getIdleWaterTemp150Duration(),
                statisticData.getIdleWaterTempOver150Duration()
        });
        statisticData.setWorkWaterTemp50Duration(ints[0]);
        statisticData.setWorkWaterTemp70Duration(ints[1]);
        statisticData.setWorkWaterTemp80Duration(ints[2]);
        statisticData.setWorkWaterTemp85Duration(ints[3]);
        statisticData.setWorkWaterTemp90Duration(ints[4]);
        statisticData.setWorkWaterTemp95Duration(ints[5]);
        statisticData.setWorkWaterTemp100Duration(ints[6]);
        statisticData.setWorkWaterTemp105Duration(ints[7]);
        statisticData.setWorkWaterTemp110Duration(ints[8]);
        statisticData.setWorkWaterTemp115Duration(ints[9]);
        statisticData.setWorkWaterTemp120Duration(ints[10]);
        statisticData.setWorkWaterTemp125Duration(ints[11]);
        statisticData.setWorkWaterTemp130Duration(ints[12]);
        statisticData.setWorkWaterTemp135Duration(ints[13]);
        statisticData.setWorkWaterTemp140Duration(ints[14]);
        statisticData.setWorkWaterTemp145Duration(ints[15]);
        statisticData.setWorkWaterTemp150Duration(ints[16]);
        statisticData.setWorkWaterTempOver150Duration(ints[17]);
        statisticData.setIdleWaterTemp50Duration(ints[18]);
        statisticData.setIdleWaterTemp70Duration(ints[19]);
        statisticData.setIdleWaterTemp80Duration(ints[20]);
        statisticData.setIdleWaterTemp85Duration(ints[21]);
        statisticData.setIdleWaterTemp90Duration(ints[22]);
        statisticData.setIdleWaterTemp95Duration(ints[23]);
        statisticData.setIdleWaterTemp100Duration(ints[24]);
        statisticData.setIdleWaterTemp105Duration(ints[25]);
        statisticData.setIdleWaterTemp110Duration(ints[26]);
        statisticData.setIdleWaterTemp115Duration(ints[27]);
        statisticData.setIdleWaterTemp120Duration(ints[28]);
        statisticData.setIdleWaterTemp125Duration(ints[29]);
        statisticData.setIdleWaterTemp130Duration(ints[30]);
        statisticData.setIdleWaterTemp135Duration(ints[31]);
        statisticData.setIdleWaterTemp140Duration(ints[32]);
        statisticData.setIdleWaterTemp145Duration(ints[33]);
        statisticData.setIdleWaterTemp150Duration(ints[34]);
        statisticData.setIdleWaterTempOver150Duration(ints[35]);


        //扭矩区间
        ints = fixArrayData(totalDuration, new Integer[]{
                statisticData.getTorque0Duration(),
                statisticData.getTorque10Duration(),
                statisticData.getTorque20Duration(),
                statisticData.getTorque30Duration(),
                statisticData.getTorque40Duration(),
                statisticData.getTorque50Duration(),
                statisticData.getTorque60Duration(),
                statisticData.getTorque70Duration(),
                statisticData.getTorque80Duration(),
                statisticData.getTorque90Duration(),
                statisticData.getTorque99Duration(),
                statisticData.getTorque100Duration()
        });
        statisticData.setTorque0Duration(ints[0]);
        statisticData.setTorque10Duration(ints[1]);
        statisticData.setTorque20Duration(ints[2]);
        statisticData.setTorque30Duration(ints[3]);
        statisticData.setTorque40Duration(ints[4]);
        statisticData.setTorque50Duration(ints[5]);
        statisticData.setTorque60Duration(ints[6]);
        statisticData.setTorque70Duration(ints[7]);
        statisticData.setTorque80Duration(ints[8]);
        statisticData.setTorque90Duration(ints[9]);
        statisticData.setTorque99Duration(ints[10]);
        statisticData.setTorque100Duration(ints[11]);

        //进气温度区间
        ints = fixArrayData(totalDuration, new Integer[]{
                statisticData.getIat50Duration(),
                statisticData.getIat70Duration(),
                statisticData.getIat80Duration(),
                statisticData.getIat85Duration(),
                statisticData.getIat90Duration(),
                statisticData.getIat95Duration(),
                statisticData.getIat100Duration(),
                statisticData.getIat105Duration(),
                statisticData.getIat110Duration(),
                statisticData.getIat115Duration(),
                statisticData.getIat120Duration(),
                statisticData.getIat125Duration(),
                statisticData.getIat130Duration(),
                statisticData.getIat135Duration(),
                statisticData.getIat140Duration(),
                statisticData.getIat145Duration(),
                statisticData.getIat150Duration(),
                statisticData.getIatOver150Duration()
        });
        statisticData.setIat50Duration(ints[0]);
        statisticData.setIat70Duration(ints[1]);
        statisticData.setIat80Duration(ints[2]);
        statisticData.setIat85Duration(ints[3]);
        statisticData.setIat90Duration(ints[4]);
        statisticData.setIat95Duration(ints[5]);
        statisticData.setIat100Duration(ints[6]);
        statisticData.setIat105Duration(ints[7]);
        statisticData.setIat110Duration(ints[8]);
        statisticData.setIat115Duration(ints[9]);
        statisticData.setIat120Duration(ints[10]);
        statisticData.setIat125Duration(ints[11]);
        statisticData.setIat130Duration(ints[12]);
        statisticData.setIat135Duration(ints[13]);
        statisticData.setIat140Duration(ints[14]);
        statisticData.setIat145Duration(ints[15]);
        statisticData.setIat150Duration(ints[16]);
        statisticData.setIatOver150Duration(ints[17]);

        //进气压力区间
        ints = fixArrayData(totalDuration, new Integer[]{
                statisticData.getIp50Duration(),
                statisticData.getIp60Duration(),
                statisticData.getIp70Duration(),
                statisticData.getIp80Duration(),
                statisticData.getIp90Duration(),
                statisticData.getIp100Duration(),
                statisticData.getIp110Duration(),
                statisticData.getIp120Duration(),
                statisticData.getIp130Duration(),
                statisticData.getIp140Duration(),
                statisticData.getIp150Duration(),
                statisticData.getIpOver150Duration()
        });
        statisticData.setIp50Duration(ints[0]);
        statisticData.setIp60Duration(ints[1]);
        statisticData.setIp70Duration(ints[2]);
        statisticData.setIp80Duration(ints[3]);
        statisticData.setIp90Duration(ints[4]);
        statisticData.setIp100Duration(ints[5]);
        statisticData.setIp110Duration(ints[6]);
        statisticData.setIp120Duration(ints[7]);
        statisticData.setIp130Duration(ints[8]);
        statisticData.setIp140Duration(ints[9]);
        statisticData.setIp150Duration(ints[10]);
        statisticData.setIpOver150Duration(ints[11]);

        //档位里程
        ints = fixArrayData(totalMileage, new Integer[]{
                statisticData.getGear01Mileage(),
                statisticData.getGear02Mileage(),
                statisticData.getGear03Mileage(),
                statisticData.getGear04Mileage(),
                statisticData.getGear05Mileage(),
                statisticData.getGear06Mileage(),
                statisticData.getGear07Mileage(),
                statisticData.getGear08Mileage(),
                statisticData.getGear09Mileage(),
                statisticData.getGear10Mileage(),
                statisticData.getGear11Mileage(),
                statisticData.getGear12Mileage(),
                statisticData.getGear13Mileage(),
                statisticData.getGear14Mileage(),
                statisticData.getGear15Mileage(),
                statisticData.getGear16Mileage(),
                statisticData.getGearOtherMileage()
        });
        statisticData.setGear01Mileage(ints[0]);
        statisticData.setGear02Mileage(ints[1]);
        statisticData.setGear03Mileage(ints[2]);
        statisticData.setGear04Mileage(ints[3]);
        statisticData.setGear05Mileage(ints[4]);
        statisticData.setGear06Mileage(ints[5]);
        statisticData.setGear07Mileage(ints[6]);
        statisticData.setGear08Mileage(ints[7]);
        statisticData.setGear09Mileage(ints[8]);
        statisticData.setGear10Mileage(ints[9]);
        statisticData.setGear11Mileage(ints[10]);
        statisticData.setGear12Mileage(ints[11]);
        statisticData.setGear13Mileage(ints[12]);
        statisticData.setGear14Mileage(ints[13]);
        statisticData.setGear15Mileage(ints[14]);
        statisticData.setGear16Mileage(ints[15]);
        statisticData.setGearOtherMileage(ints[16]);
        //档位油耗
        ints = fixArrayData(totalFuel, new Integer[]{
                statisticData.getGear01Fuel(),
                statisticData.getGear02Fuel(),
                statisticData.getGear03Fuel(),
                statisticData.getGear04Fuel(),
                statisticData.getGear05Fuel(),
                statisticData.getGear06Fuel(),
                statisticData.getGear07Fuel(),
                statisticData.getGear08Fuel(),
                statisticData.getGear09Fuel(),
                statisticData.getGear10Fuel(),
                statisticData.getGear11Fuel(),
                statisticData.getGear12Fuel(),
                statisticData.getGear13Fuel(),
                statisticData.getGear14Fuel(),
                statisticData.getGear15Fuel(),
                statisticData.getGear16Fuel(),
                statisticData.getGearOtherFuel()
        });
        statisticData.setGear01Fuel(ints[0]);
        statisticData.setGear02Fuel(ints[1]);
        statisticData.setGear03Fuel(ints[2]);
        statisticData.setGear04Fuel(ints[3]);
        statisticData.setGear05Fuel(ints[4]);
        statisticData.setGear06Fuel(ints[5]);
        statisticData.setGear07Fuel(ints[6]);
        statisticData.setGear08Fuel(ints[7]);
        statisticData.setGear09Fuel(ints[8]);
        statisticData.setGear10Fuel(ints[9]);
        statisticData.setGear11Fuel(ints[10]);
        statisticData.setGear12Fuel(ints[11]);
        statisticData.setGear13Fuel(ints[12]);
        statisticData.setGear14Fuel(ints[13]);
        statisticData.setGear15Fuel(ints[14]);
        statisticData.setGear16Fuel(ints[15]);
        statisticData.setGearOtherFuel(ints[16]);
        //档位时长
        ints = fixArrayData(totalDuration, new Integer[]{
                statisticData.getGear01Duration(),
                statisticData.getGear02Duration(),
                statisticData.getGear03Duration(),
                statisticData.getGear04Duration(),
                statisticData.getGear05Duration(),
                statisticData.getGear06Duration(),
                statisticData.getGear07Duration(),
                statisticData.getGear08Duration(),
                statisticData.getGear09Duration(),
                statisticData.getGear10Duration(),
                statisticData.getGear11Duration(),
                statisticData.getGear12Duration(),
                statisticData.getGear13Duration(),
                statisticData.getGear14Duration(),
                statisticData.getGear15Duration(),
                statisticData.getGear16Duration(),
                statisticData.getGearOtherDuration()
        });
        statisticData.setGear01Duration(ints[0]);
        statisticData.setGear02Duration(ints[1]);
        statisticData.setGear03Duration(ints[2]);
        statisticData.setGear04Duration(ints[3]);
        statisticData.setGear05Duration(ints[4]);
        statisticData.setGear06Duration(ints[5]);
        statisticData.setGear07Duration(ints[6]);
        statisticData.setGear08Duration(ints[7]);
        statisticData.setGear09Duration(ints[8]);
        statisticData.setGear10Duration(ints[9]);
        statisticData.setGear11Duration(ints[10]);
        statisticData.setGear12Duration(ints[11]);
        statisticData.setGear13Duration(ints[12]);
        statisticData.setGear14Duration(ints[13]);
        statisticData.setGear15Duration(ints[14]);
        statisticData.setGear16Duration(ints[15]);
        statisticData.setGearOtherDuration(ints[16]);

        //转速区间里程
        ints = fixArrayData(totalMileage, new Integer[]{
                statisticData.getRpmRange500Mileage(),
                statisticData.getRpmRange600Mileage(),
                statisticData.getRpmRange700Mileage(),
                statisticData.getRpmRange800Mileage(),
                statisticData.getRpmRange900Mileage(),
                statisticData.getRpmRange1000Mileage(),
                statisticData.getRpmRange1100Mileage(),
                statisticData.getRpmRange1200Mileage(),
                statisticData.getRpmRange1300Mileage(),
                statisticData.getRpmRange1400Mileage(),
                statisticData.getRpmRange1500Mileage(),
                statisticData.getRpmRange1600Mileage(),
                statisticData.getRpmRange1700Mileage(),
                statisticData.getRpmRange1800Mileage(),
                statisticData.getRpmRange1900Mileage(),
                statisticData.getRpmRange2000Mileage(),
                statisticData.getRpmRange2100Mileage(),
                statisticData.getRpmRange2200Mileage(),
                statisticData.getRpmRange2300Mileage(),
                statisticData.getRpmRange2400Mileage(),
                statisticData.getRpmRange2500Mileage(),
                statisticData.getRpmRange2600Mileage(),
                statisticData.getRpmRange2700Mileage(),
                statisticData.getRpmRange2800Mileage(),
                statisticData.getRpmRange2900Mileage(),
                statisticData.getRpmRange3000Mileage(),
                statisticData.getRpmRangeOver3000Mileage(),
        });
        statisticData.setRpmRange500Mileage(ints[0]);
        statisticData.setRpmRange600Mileage(ints[1]);
        statisticData.setRpmRange700Mileage(ints[2]);
        statisticData.setRpmRange800Mileage(ints[3]);
        statisticData.setRpmRange900Mileage(ints[4]);
        statisticData.setRpmRange1000Mileage(ints[5]);
        statisticData.setRpmRange1100Mileage(ints[6]);
        statisticData.setRpmRange1200Mileage(ints[7]);
        statisticData.setRpmRange1300Mileage(ints[8]);
        statisticData.setRpmRange1400Mileage(ints[9]);
        statisticData.setRpmRange1500Mileage(ints[10]);
        statisticData.setRpmRange1600Mileage(ints[11]);
        statisticData.setRpmRange1700Mileage(ints[12]);
        statisticData.setRpmRange1800Mileage(ints[13]);
        statisticData.setRpmRange1900Mileage(ints[14]);
        statisticData.setRpmRange2000Mileage(ints[15]);
        statisticData.setRpmRange2100Mileage(ints[16]);
        statisticData.setRpmRange2200Mileage(ints[17]);
        statisticData.setRpmRange2300Mileage(ints[18]);
        statisticData.setRpmRange2400Mileage(ints[19]);
        statisticData.setRpmRange2500Mileage(ints[20]);
        statisticData.setRpmRange2600Mileage(ints[21]);
        statisticData.setRpmRange2700Mileage(ints[22]);
        statisticData.setRpmRange2800Mileage(ints[23]);
        statisticData.setRpmRange2900Mileage(ints[24]);
        statisticData.setRpmRange3000Mileage(ints[25]);
        statisticData.setRpmRangeOver3000Mileage(ints[26]);
        //转速区间时长
        ints = fixArrayData(totalDuration, new Integer[]{
                statisticData.getRpmRange500Duration(),
                statisticData.getRpmRange600Duration(),
                statisticData.getRpmRange700Duration(),
                statisticData.getRpmRange800Duration(),
                statisticData.getRpmRange900Duration(),
                statisticData.getRpmRange1000Duration(),
                statisticData.getRpmRange1100Duration(),
                statisticData.getRpmRange1200Duration(),
                statisticData.getRpmRange1300Duration(),
                statisticData.getRpmRange1400Duration(),
                statisticData.getRpmRange1500Duration(),
                statisticData.getRpmRange1600Duration(),
                statisticData.getRpmRange1700Duration(),
                statisticData.getRpmRange1800Duration(),
                statisticData.getRpmRange1900Duration(),
                statisticData.getRpmRange2000Duration(),
                statisticData.getRpmRange2100Duration(),
                statisticData.getRpmRange2200Duration(),
                statisticData.getRpmRange2300Duration(),
                statisticData.getRpmRange2400Duration(),
                statisticData.getRpmRange2500Duration(),
                statisticData.getRpmRange2600Duration(),
                statisticData.getRpmRange2700Duration(),
                statisticData.getRpmRange2800Duration(),
                statisticData.getRpmRange2900Duration(),
                statisticData.getRpmRange3000Duration(),
                statisticData.getRpmRangeOver3000Duration(),
        });
        statisticData.setRpmRange500Duration(ints[0]);
        statisticData.setRpmRange600Duration(ints[1]);
        statisticData.setRpmRange700Duration(ints[2]);
        statisticData.setRpmRange800Duration(ints[3]);
        statisticData.setRpmRange900Duration(ints[4]);
        statisticData.setRpmRange1000Duration(ints[5]);
        statisticData.setRpmRange1100Duration(ints[6]);
        statisticData.setRpmRange1200Duration(ints[7]);
        statisticData.setRpmRange1300Duration(ints[8]);
        statisticData.setRpmRange1400Duration(ints[9]);
        statisticData.setRpmRange1500Duration(ints[10]);
        statisticData.setRpmRange1600Duration(ints[11]);
        statisticData.setRpmRange1700Duration(ints[12]);
        statisticData.setRpmRange1800Duration(ints[13]);
        statisticData.setRpmRange1900Duration(ints[14]);
        statisticData.setRpmRange2000Duration(ints[15]);
        statisticData.setRpmRange2100Duration(ints[16]);
        statisticData.setRpmRange2200Duration(ints[17]);
        statisticData.setRpmRange2300Duration(ints[18]);
        statisticData.setRpmRange2400Duration(ints[19]);
        statisticData.setRpmRange2500Duration(ints[20]);
        statisticData.setRpmRange2600Duration(ints[21]);
        statisticData.setRpmRange2700Duration(ints[22]);
        statisticData.setRpmRange2800Duration(ints[23]);
        statisticData.setRpmRange2900Duration(ints[24]);
        statisticData.setRpmRange3000Duration(ints[25]);
        statisticData.setRpmRangeOver3000Duration(ints[26]);
        //转速区间油耗
        ints = fixArrayData(totalFuel, new Integer[]{
                statisticData.getRpmRange500Fuel(),
                statisticData.getRpmRange600Fuel(),
                statisticData.getRpmRange700Fuel(),
                statisticData.getRpmRange800Fuel(),
                statisticData.getRpmRange900Fuel(),
                statisticData.getRpmRange1000Fuel(),
                statisticData.getRpmRange1100Fuel(),
                statisticData.getRpmRange1200Fuel(),
                statisticData.getRpmRange1300Fuel(),
                statisticData.getRpmRange1400Fuel(),
                statisticData.getRpmRange1500Fuel(),
                statisticData.getRpmRange1600Fuel(),
                statisticData.getRpmRange1700Fuel(),
                statisticData.getRpmRange1800Fuel(),
                statisticData.getRpmRange1900Fuel(),
                statisticData.getRpmRange2000Fuel(),
                statisticData.getRpmRange2100Fuel(),
                statisticData.getRpmRange2200Fuel(),
                statisticData.getRpmRange2300Fuel(),
                statisticData.getRpmRange2400Fuel(),
                statisticData.getRpmRange2500Fuel(),
                statisticData.getRpmRange2600Fuel(),
                statisticData.getRpmRange2700Fuel(),
                statisticData.getRpmRange2800Fuel(),
                statisticData.getRpmRange2900Fuel(),
                statisticData.getRpmRange3000Fuel(),
                statisticData.getRpmRangeOver3000Fuel(),
        });
        statisticData.setRpmRange500Fuel(ints[0]);
        statisticData.setRpmRange600Fuel(ints[1]);
        statisticData.setRpmRange700Fuel(ints[2]);
        statisticData.setRpmRange800Fuel(ints[3]);
        statisticData.setRpmRange900Fuel(ints[4]);
        statisticData.setRpmRange1000Fuel(ints[5]);
        statisticData.setRpmRange1100Fuel(ints[6]);
        statisticData.setRpmRange1200Fuel(ints[7]);
        statisticData.setRpmRange1300Fuel(ints[8]);
        statisticData.setRpmRange1400Fuel(ints[9]);
        statisticData.setRpmRange1500Fuel(ints[10]);
        statisticData.setRpmRange1600Fuel(ints[11]);
        statisticData.setRpmRange1700Fuel(ints[12]);
        statisticData.setRpmRange1800Fuel(ints[13]);
        statisticData.setRpmRange1900Fuel(ints[14]);
        statisticData.setRpmRange2000Fuel(ints[15]);
        statisticData.setRpmRange2100Fuel(ints[16]);
        statisticData.setRpmRange2200Fuel(ints[17]);
        statisticData.setRpmRange2300Fuel(ints[18]);
        statisticData.setRpmRange2400Fuel(ints[19]);
        statisticData.setRpmRange2500Fuel(ints[20]);
        statisticData.setRpmRange2600Fuel(ints[21]);
        statisticData.setRpmRange2700Fuel(ints[22]);
        statisticData.setRpmRange2800Fuel(ints[23]);
        statisticData.setRpmRange2900Fuel(ints[24]);
        statisticData.setRpmRange3000Fuel(ints[25]);
        statisticData.setRpmRangeOver3000Fuel(ints[26]);

        //海拔区间
        fixRangeData(totalMileage, totalFuel, totalDuration, statisticData.getAltitudeRanges());
        //小时区间
        fixRangeData(totalMileage, totalFuel, totalDuration, statisticData.getClockRanges());

        //超速90km/h时长
        statisticData.setSo90Duration(fixSingleData(totalDuration0,totalDuration, statisticData.getSo90Duration()));
        //超速90km/h里程
        statisticData.setSo90Mileage(fixSingleData(totalMileage0,totalMileage, statisticData.getSo90Mileage()));
        //超速90km/h油耗
        statisticData.setSo90Fuel(fixSingleData(totalFuel0,totalFuel, statisticData.getSo90Fuel()));
        //超速120km/h时长
        statisticData.setSo120Duration(fixSingleData(totalDuration0,totalDuration, statisticData.getSo120Duration()));
        //超速120km/h里程
        statisticData.setSo120Mileage(fixSingleData(totalMileage0,totalMileage, statisticData.getSo120Mileage()));
        //超速120km/h油耗
        statisticData.setSo120Fuel(fixSingleData(totalFuel0,totalFuel, statisticData.getSo120Fuel()));

        //超转速时长
        statisticData.setSrDuration(fixSingleData(totalDuration0,totalDuration, statisticData.getSrDuration()));
        //超转速里程
        statisticData.setSrMileage(fixSingleData(totalMileage0,totalMileage, statisticData.getSrMileage()));
        //超转速油耗
        statisticData.setSrFuel(fixSingleData(totalFuel0,totalFuel, statisticData.getSrFuel()));

        //低转速（脱档）时长
        statisticData.setLrogDuration(fixSingleData(totalDuration0,totalDuration, statisticData.getLrogDuration()));
        //低转速（脱档）里程
        statisticData.setLrogMileage(fixSingleData(totalMileage0,totalMileage, statisticData.getLrogMileage()));
        //低转速油耗
        statisticData.setLrogFuel(fixSingleData(totalFuel0,totalFuel, statisticData.getLrogFuel()));

        //高速刹车时长
        statisticData.setHsbDuration(fixSingleData(totalDuration0,totalDuration, statisticData.getHsbDuration()));
        //高速刹车里程
        statisticData.setHsbMileage(fixSingleData(totalMileage0,totalMileage, statisticData.getHsbMileage()));

        //普通刹车时长
        statisticData.setCsbDuration(fixSingleData(totalDuration0,totalDuration, statisticData.getCsbDuration()));
        //普通刹车里程
        statisticData.setCsbMileage(fixSingleData(totalMileage0,totalMileage, statisticData.getCsbMileage()));

        //离合时长
        statisticData.setClutchDuration(fixSingleData(totalDuration0,totalDuration, statisticData.getClutchDuration()));
        //离合里程
        statisticData.setClutchMileage(fixSingleData(totalMileage0,totalMileage, statisticData.getClutchMileage()));

        //急转弯行驶距离
        statisticData.setSharpTurningMil(fixSingleData(totalMileage0,totalMileage, statisticData.getSharpTurningMil()));

        //疲劳驾驶时长
        statisticData.setFatigueDrivingDuration(fixSingleData(totalDuration0,totalDuration, statisticData.getFatigueDrivingDuration()));

        //经过城市的里程油耗
        statisticData.getCrossCitiesDetail().forEach(e -> {
            e.setMileage(fixSingleData(totalMileage0, totalMileage, e.getMileage()));
            e.setFuel(fixSingleData(totalFuel0, totalFuel, e.getFuel()));
        });

        //东风急加速距离 单位:M
        statisticData.setSharpUpSpeedMileage_DF(fixSingleData(totalMileage0,totalMileage, statisticData.getSharpUpSpeedMileage_DF()));
        //东风急加速油耗 单位:ML
        statisticData.setSharpUpSpeedFuel_DF(fixSingleData(totalFuel0,totalFuel, statisticData.getSharpUpSpeedFuel_DF()));
        //东风急加速时长 单位: S
        statisticData.setSharpUpSpeedDuration_DF(fixSingleData(totalDuration0,totalDuration, statisticData.getSharpUpSpeedDuration_DF()));

        //东风急减速距离 单位:M
        statisticData.setSharpDownSpeedMileage_DF(fixSingleData(totalMileage0,totalMileage, statisticData.getSharpDownSpeedMileage_DF()));
        //东风急减速油耗 单位:ML
        statisticData.setSharpDownSpeedFuel_DF(fixSingleData(totalFuel0,totalFuel, statisticData.getSharpDownSpeedFuel_DF()));
        //东风急减速时长 单位: S
        statisticData.setSharpDownSpeedDuration_DF(fixSingleData(totalDuration0,totalDuration, statisticData.getSharpDownSpeedDuration_DF()));

        //东风超长怠速油耗 单位:ML
        statisticData.setLongIdleFuel_DF(fixSingleData(totalFuel0,totalFuel, statisticData.getLongIdleFuel_DF()));
        //东风超长怠速时长 单位:S
        statisticData.setLongIdleDuration_DF(fixSingleData(totalDuration0,totalDuration, statisticData.getLongIdleDuration_DF()));

        //东风冷车运行距离 单位:M
        statisticData.setColdRunningMileage_DF(fixSingleData(totalMileage0,totalMileage, statisticData.getColdRunningMileage_DF()));
        //东风冷车运行油耗 单位:ML
        statisticData.setColdRunningFuel_DF(fixSingleData(totalFuel0,totalFuel, statisticData.getColdRunningFuel_DF()));
        //东风冷车运行时长 单位:S
        statisticData.setColdRunningDuration_DF(fixSingleData(totalDuration0,totalDuration, statisticData.getColdRunningDuration_DF()));

        //东风夜晚开车距离 单位:M
        statisticData.setNightRunningMileage_DF(fixSingleData(totalMileage0,totalMileage, statisticData.getNightRunningMileage_DF()));
        //东风夜晚开车油耗 单位:ML
        statisticData.setNightRunningFuel_DF(fixSingleData(totalFuel0,totalFuel, statisticData.getNightRunningFuel_DF()));
        //东风夜晚开车时长 单位: S
        statisticData.setNightRunningDuration_DF(fixSingleData(totalDuration0,totalDuration, statisticData.getNightRunningDuration_DF()));

        //东风引擎高转速里程 单位:M
        statisticData.setHighRotationMileage_DF(fixSingleData(totalMileage0,totalMileage, statisticData.getHighRotationMileage_DF()));
        //东风引擎高转速油耗 单位:ML
        statisticData.setHighRotationFuel_DF(fixSingleData(totalFuel0,totalFuel, statisticData.getHighRotationFuel_DF()));
        //东风引擎高转速时长 单位: S
        statisticData.setHighRotationDuration_DF(fixSingleData(totalDuration0,totalDuration, statisticData.getHighRotationDuration_DF()));

        //东风大油门里程 单位:M
        statisticData.setLargeGasMileage_DF(fixSingleData(totalMileage0,totalMileage, statisticData.getLargeGasMileage_DF()));
        //东风大油门油耗 单位:ML
        statisticData.setLargeGasFuel_DF(fixSingleData(totalFuel0,totalFuel, statisticData.getLargeGasFuel_DF()));
        //东风大油门时长 单位: S
        statisticData.setLargeGasDuration_DF(fixSingleData(totalDuration0,totalDuration, statisticData.getLargeGasDuration_DF()));

        //东风全油门里程 单位:M
        statisticData.setFullGasMileage_DF(fixSingleData(totalMileage0,totalMileage, statisticData.getFullGasMileage_DF()));
        //东风全油门油耗 单位:ML
        statisticData.setFullGasFuel_DF(fixSingleData(totalFuel0,totalFuel, statisticData.getFullGasFuel_DF()));
        //东风全油门时长 单位: S
        statisticData.setFullGasDuration_DF(fixSingleData(totalDuration0,totalDuration, statisticData.getFullGasDuration_DF()));

        //东风高速行驶里程 单位:M
        statisticData.setFastSpeedMileage_DF(fixSingleData(totalMileage0,totalMileage, statisticData.getFastSpeedMileage_DF()));
        //东风高速行驶油耗 单位:ML
        statisticData.setFastSpeedFuel_DF(fixSingleData(totalFuel0,totalFuel, statisticData.getFastSpeedFuel_DF()));
        //东风高速行驶时长 单位: S
        statisticData.setFastSpeedDuration_DF(fixSingleData(totalDuration0,totalDuration, statisticData.getFastSpeedDuration_DF()));

        //东风空挡滑行里程 单位:M
        statisticData.setNeutralGearCoastMileage_DF(fixSingleData(totalMileage0,totalMileage, statisticData.getNeutralGearCoastMileage_DF()));
        //东风空挡滑行油耗 单位:ML
        statisticData.setNeutralGearCoastFuel_DF(fixSingleData(totalFuel0,totalFuel, statisticData.getNeutralGearCoastFuel_DF()));
        //东风空挡滑行时长 单位：秒
        statisticData.setNeutralGearCoastDuration_DF(fixSingleData(totalDuration0,totalDuration, statisticData.getNeutralGearCoastDuration_DF()));

        //东风熄火滑行里程 单位:M
        statisticData.setFlameoutCoastMileage_DF(fixSingleData(totalMileage0,totalMileage, statisticData.getFlameoutCoastMileage_DF()));
        //东风熄火滑行油耗 单位:ML
        statisticData.setFlameoutCoastFuel_DF(fixSingleData(totalFuel0,totalFuel, statisticData.getFlameoutCoastFuel_DF()));
        //东风熄火滑行时长 单位：秒
        statisticData.setFlameoutCoastDuration_DF(fixSingleData(totalDuration0,totalDuration, statisticData.getFlameoutCoastDuration_DF()));

        //东风新版，冷车运行
        statisticData.setColdRunningMileage_DFN(fixSingleData(totalMileage0,totalMileage, statisticData.getColdRunningMileage_DFN()));
        statisticData.setColdRunningFuel_DFN(fixSingleData(totalFuel0,totalFuel, statisticData.getColdRunningFuel_DFN()));
        statisticData.setColdRunningDuration_DFN(fixSingleData(totalDuration0,totalDuration, statisticData.getColdRunningDuration_DFN()));

        //东风新版，非经济行驶
        statisticData.setNoEcoMileage_DFN(fixSingleData(totalMileage0,totalMileage, statisticData.getNoEcoMileage_DFN()));
        statisticData.setNoEcoFuel_DFN(fixSingleData(totalFuel0,totalFuel, statisticData.getNoEcoFuel_DFN()));
        statisticData.setNoEcoDuration_DFN(fixSingleData(totalDuration0,totalDuration, statisticData.getNoEcoDuration_DFN()));

        //青汽一汽，经济车速修正
        statisticData.setEconomicSpeedMileage(fixSingleData(totalMileage0,totalMileage, statisticData.getEconomicSpeedMileage()));
        statisticData.setEconomicSpeedFuel(fixSingleData(totalFuel0,totalFuel, statisticData.getEconomicSpeedFuel()));
        statisticData.setEconomicSpeedDuration(fixSingleData(totalDuration0,totalDuration, statisticData.getEconomicSpeedDuration()));
        statisticData.setEconomicSpeedNoCoastMileage(fixSingleData(totalMileage0,totalMileage, statisticData.getEconomicSpeedNoCoastMileage()));

        //青汽一汽，经济转速且非下坡修正
        statisticData.setEcoNoDownMileage(fixSingleData(totalMileage0,totalMileage, statisticData.getEcoNoDownMileage()));
        statisticData.setEcoNoDownFuel(fixSingleData(totalFuel0,totalFuel, statisticData.getEcoNoDownFuel()));
        statisticData.setEcoNoDownDuration(fixSingleData(totalDuration0,totalDuration, statisticData.getEcoNoDownDuration()));

        //青汽一汽，超经济行驶且非下坡修正
        statisticData.setEcoOverNoDownMileage(fixSingleData(totalMileage0,totalMileage, statisticData.getEcoOverNoDownMileage()));
        statisticData.setEcoOverNoDownFuel(fixSingleData(totalFuel0,totalFuel, statisticData.getEcoOverNoDownFuel()));
        statisticData.setEcoOverNoDownDuration(fixSingleData(totalDuration0,totalDuration, statisticData.getEcoOverNoDownDuration()));

        //青汽一汽，坡度区间统计指标修正
        RangeDrivingSlopeStatisticsData rangeDrivingSlopeStatisticsData = statisticData.getRangeDrivingSlopeStatisticsData();
        if(rangeDrivingSlopeStatisticsData != null) {
            ints = fixArrayData(totalMileage, new Integer[]{
                    rangeDrivingSlopeStatisticsData.getSlopeRangeF5_mileage(),
                    rangeDrivingSlopeStatisticsData.getSlopeRangeF4_mileage(),
                    rangeDrivingSlopeStatisticsData.getSlopeRangeF3_mileage(),
                    rangeDrivingSlopeStatisticsData.getSlopeRangeF2_mileage(),
                    rangeDrivingSlopeStatisticsData.getSlopeRangeF1_mileage(),
                    rangeDrivingSlopeStatisticsData.getSlopeRange0_mileage(),
                    rangeDrivingSlopeStatisticsData.getSlopeRange1_mileage(),
                    rangeDrivingSlopeStatisticsData.getSlopeRange2_mileage(),
                    rangeDrivingSlopeStatisticsData.getSlopeRange3_mileage(),
                    rangeDrivingSlopeStatisticsData.getSlopeRange4_mileage(),
                    rangeDrivingSlopeStatisticsData.getSlopeRange5_mileage(),
                    rangeDrivingSlopeStatisticsData.getSlopeRangeOver_mileage()
            });
            rangeDrivingSlopeStatisticsData.setSlopeRangeF5_mileage(ints[0]);
            rangeDrivingSlopeStatisticsData.setSlopeRangeF4_mileage(ints[1]);
            rangeDrivingSlopeStatisticsData.setSlopeRangeF3_mileage(ints[2]);
            rangeDrivingSlopeStatisticsData.setSlopeRangeF2_mileage(ints[3]);
            rangeDrivingSlopeStatisticsData.setSlopeRangeF1_mileage(ints[4]);
            rangeDrivingSlopeStatisticsData.setSlopeRange0_mileage(ints[5]);
            rangeDrivingSlopeStatisticsData.setSlopeRange1_mileage(ints[6]);
            rangeDrivingSlopeStatisticsData.setSlopeRange2_mileage(ints[7]);
            rangeDrivingSlopeStatisticsData.setSlopeRange3_mileage(ints[8]);
            rangeDrivingSlopeStatisticsData.setSlopeRange4_mileage(ints[9]);
            rangeDrivingSlopeStatisticsData.setSlopeRange5_mileage(ints[10]);
            rangeDrivingSlopeStatisticsData.setSlopeRangeOver_mileage(ints[11]);

            ints = fixArrayData(totalFuel, new Integer[]{
                    rangeDrivingSlopeStatisticsData.getSlopeRangeF5_fuel(),
                    rangeDrivingSlopeStatisticsData.getSlopeRangeF4_fuel(),
                    rangeDrivingSlopeStatisticsData.getSlopeRangeF3_fuel(),
                    rangeDrivingSlopeStatisticsData.getSlopeRangeF2_fuel(),
                    rangeDrivingSlopeStatisticsData.getSlopeRangeF1_fuel(),
                    rangeDrivingSlopeStatisticsData.getSlopeRange0_fuel(),
                    rangeDrivingSlopeStatisticsData.getSlopeRange1_fuel(),
                    rangeDrivingSlopeStatisticsData.getSlopeRange2_fuel(),
                    rangeDrivingSlopeStatisticsData.getSlopeRange3_fuel(),
                    rangeDrivingSlopeStatisticsData.getSlopeRange4_fuel(),
                    rangeDrivingSlopeStatisticsData.getSlopeRange5_fuel(),
                    rangeDrivingSlopeStatisticsData.getSlopeRangeOver_fuel()
            });
            rangeDrivingSlopeStatisticsData.setSlopeRangeF5_fuel(ints[0]);
            rangeDrivingSlopeStatisticsData.setSlopeRangeF4_fuel(ints[1]);
            rangeDrivingSlopeStatisticsData.setSlopeRangeF3_fuel(ints[2]);
            rangeDrivingSlopeStatisticsData.setSlopeRangeF2_fuel(ints[3]);
            rangeDrivingSlopeStatisticsData.setSlopeRangeF1_fuel(ints[4]);
            rangeDrivingSlopeStatisticsData.setSlopeRange0_fuel(ints[5]);
            rangeDrivingSlopeStatisticsData.setSlopeRange1_fuel(ints[6]);
            rangeDrivingSlopeStatisticsData.setSlopeRange2_fuel(ints[7]);
            rangeDrivingSlopeStatisticsData.setSlopeRange3_fuel(ints[8]);
            rangeDrivingSlopeStatisticsData.setSlopeRange4_fuel(ints[9]);
            rangeDrivingSlopeStatisticsData.setSlopeRange5_fuel(ints[10]);
            rangeDrivingSlopeStatisticsData.setSlopeRangeOver_fuel(ints[11]);

            ints = fixArrayData(totalDuration, new Integer[]{
                    rangeDrivingSlopeStatisticsData.getSlopeRangeF5_duration(),
                    rangeDrivingSlopeStatisticsData.getSlopeRangeF4_duration(),
                    rangeDrivingSlopeStatisticsData.getSlopeRangeF3_duration(),
                    rangeDrivingSlopeStatisticsData.getSlopeRangeF2_duration(),
                    rangeDrivingSlopeStatisticsData.getSlopeRangeF1_duration(),
                    rangeDrivingSlopeStatisticsData.getSlopeRange0_duration(),
                    rangeDrivingSlopeStatisticsData.getSlopeRange1_duration(),
                    rangeDrivingSlopeStatisticsData.getSlopeRange2_duration(),
                    rangeDrivingSlopeStatisticsData.getSlopeRange3_duration(),
                    rangeDrivingSlopeStatisticsData.getSlopeRange4_duration(),
                    rangeDrivingSlopeStatisticsData.getSlopeRange5_duration(),
                    rangeDrivingSlopeStatisticsData.getSlopeRangeOver_duration()
            });
            rangeDrivingSlopeStatisticsData.setSlopeRangeF5_duration(ints[0]);
            rangeDrivingSlopeStatisticsData.setSlopeRangeF4_duration(ints[1]);
            rangeDrivingSlopeStatisticsData.setSlopeRangeF3_duration(ints[2]);
            rangeDrivingSlopeStatisticsData.setSlopeRangeF2_duration(ints[3]);
            rangeDrivingSlopeStatisticsData.setSlopeRangeF1_duration(ints[4]);
            rangeDrivingSlopeStatisticsData.setSlopeRange0_duration(ints[5]);
            rangeDrivingSlopeStatisticsData.setSlopeRange1_duration(ints[6]);
            rangeDrivingSlopeStatisticsData.setSlopeRange2_duration(ints[7]);
            rangeDrivingSlopeStatisticsData.setSlopeRange3_duration(ints[8]);
            rangeDrivingSlopeStatisticsData.setSlopeRange4_duration(ints[9]);
            rangeDrivingSlopeStatisticsData.setSlopeRange5_duration(ints[10]);
            rangeDrivingSlopeStatisticsData.setSlopeRangeOver_duration(ints[11]);

            statisticData.setRangeDrivingSlopeStatisticsData(rangeDrivingSlopeStatisticsData);
        }else{
            statisticData.setRangeDrivingSlopeStatisticsData(new RangeDrivingSlopeStatisticsData());
        }

        //青汽、一汽油门开度区间修正

        ints = fixArrayData(totalDuration, new Integer[]{
                statisticData.getGasOpenPercent0Duration(),
                statisticData.getGasOpenPercent10Duration(),
                statisticData.getGasOpenPercent20Duration(),
                statisticData.getGasOpenPercent30Duration(),
                statisticData.getGasOpenPercent40Duration(),
                statisticData.getGasOpenPercent50Duration(),
                statisticData.getGasOpenPercent60Duration(),
                statisticData.getGasOpenPercent70Duration(),
                statisticData.getGasOpenPercent80Duration(),
                statisticData.getGasOpenPercent90Duration(),
                statisticData.getGasOpenPercent99Duration(),
                statisticData.getGasOpenPercent100Duration()
        });
        statisticData.setGasOpenPercent0Duration(ints[0]);
        statisticData.setGasOpenPercent10Duration(ints[1]);
        statisticData.setGasOpenPercent20Duration(ints[2]);
        statisticData.setGasOpenPercent30Duration(ints[3]);
        statisticData.setGasOpenPercent40Duration(ints[4]);
        statisticData.setGasOpenPercent50Duration(ints[5]);
        statisticData.setGasOpenPercent60Duration(ints[6]);
        statisticData.setGasOpenPercent70Duration(ints[7]);
        statisticData.setGasOpenPercent80Duration(ints[8]);
        statisticData.setGasOpenPercent90Duration(ints[9]);
        statisticData.setGasOpenPercent99Duration(ints[10]);
        statisticData.setGasOpenPercent100Duration(ints[11]);

        ints = fixArrayData(totalMileage, new Integer[]{
                statisticData.getGasOpenPercent0Mileage(),
                statisticData.getGasOpenPercent10Mileage(),
                statisticData.getGasOpenPercent20Mileage(),
                statisticData.getGasOpenPercent30Mileage(),
                statisticData.getGasOpenPercent40Mileage(),
                statisticData.getGasOpenPercent50Mileage(),
                statisticData.getGasOpenPercent60Mileage(),
                statisticData.getGasOpenPercent70Mileage(),
                statisticData.getGasOpenPercent80Mileage(),
                statisticData.getGasOpenPercent90Mileage(),
                statisticData.getGasOpenPercent99Mileage(),
                statisticData.getGasOpenPercent100Mileage()
        });
        statisticData.setGasOpenPercent0Mileage(ints[0]);
        statisticData.setGasOpenPercent10Mileage(ints[1]);
        statisticData.setGasOpenPercent20Mileage(ints[2]);
        statisticData.setGasOpenPercent30Mileage(ints[3]);
        statisticData.setGasOpenPercent40Mileage(ints[4]);
        statisticData.setGasOpenPercent50Mileage(ints[5]);
        statisticData.setGasOpenPercent60Mileage(ints[6]);
        statisticData.setGasOpenPercent70Mileage(ints[7]);
        statisticData.setGasOpenPercent80Mileage(ints[8]);
        statisticData.setGasOpenPercent90Mileage(ints[9]);
        statisticData.setGasOpenPercent99Mileage(ints[10]);
        statisticData.setGasOpenPercent100Mileage(ints[11]);

        ints = fixArrayData(totalFuel, new Integer[]{
                statisticData.getGasOpenPercent0Fuel(),
                statisticData.getGasOpenPercent10Fuel(),
                statisticData.getGasOpenPercent20Fuel(),
                statisticData.getGasOpenPercent30Fuel(),
                statisticData.getGasOpenPercent40Fuel(),
                statisticData.getGasOpenPercent50Fuel(),
                statisticData.getGasOpenPercent60Fuel(),
                statisticData.getGasOpenPercent70Fuel(),
                statisticData.getGasOpenPercent80Fuel(),
                statisticData.getGasOpenPercent90Fuel(),
                statisticData.getGasOpenPercent99Fuel(),
                statisticData.getGasOpenPercent100Fuel()
        });
        statisticData.setGasOpenPercent0Fuel(ints[0]);
        statisticData.setGasOpenPercent10Fuel(ints[1]);
        statisticData.setGasOpenPercent20Fuel(ints[2]);
        statisticData.setGasOpenPercent30Fuel(ints[3]);
        statisticData.setGasOpenPercent40Fuel(ints[4]);
        statisticData.setGasOpenPercent50Fuel(ints[5]);
        statisticData.setGasOpenPercent60Fuel(ints[6]);
        statisticData.setGasOpenPercent70Fuel(ints[7]);
        statisticData.setGasOpenPercent80Fuel(ints[8]);
        statisticData.setGasOpenPercent90Fuel(ints[9]);
        statisticData.setGasOpenPercent99Fuel(ints[10]);
        statisticData.setGasOpenPercent100Fuel(ints[11]);

        //青汽、一汽油门开度每秒变化修正
        RangeDiffGasOpenPercentStatisticsData rangeDiffGasOpenPercentStatisticsData = statisticData.getRangeDiffGasOpenPercentStatisticsData();
        if(rangeDiffGasOpenPercentStatisticsData != null){
            ints = fixArrayData(totalMileage, new Integer[]{
                    rangeDiffGasOpenPercentStatisticsData.getDiffGasOpenPercentRangeF50_mileage(),
                    rangeDiffGasOpenPercentStatisticsData.getDiffGasOpenPercentRangeF40_mileage(),
                    rangeDiffGasOpenPercentStatisticsData.getDiffGasOpenPercentRangeF30_mileage(),
                    rangeDiffGasOpenPercentStatisticsData.getDiffGasOpenPercentRangeF20_mileage(),
                    rangeDiffGasOpenPercentStatisticsData.getDiffGasOpenPercentRangeF10_mileage(),
                    rangeDiffGasOpenPercentStatisticsData.getDiffGasOpenPercentRange0_mileage(),
                    rangeDiffGasOpenPercentStatisticsData.getDiffGasOpenPercentRangeEq0_mileage(),
                    rangeDiffGasOpenPercentStatisticsData.getDiffGasOpenPercentRange10_mileage(),
                    rangeDiffGasOpenPercentStatisticsData.getDiffGasOpenPercentRange20_mileage(),
                    rangeDiffGasOpenPercentStatisticsData.getDiffGasOpenPercentRange30_mileage(),
                    rangeDiffGasOpenPercentStatisticsData.getDiffGasOpenPercentRange40_mileage(),
                    rangeDiffGasOpenPercentStatisticsData.getDiffGasOpenPercentRange50_mileage(),
                    rangeDiffGasOpenPercentStatisticsData.getDiffGasOpenPercentRangeMax_mileage()
            });
            rangeDiffGasOpenPercentStatisticsData.setDiffGasOpenPercentRangeF50_mileage(ints[0]);
            rangeDiffGasOpenPercentStatisticsData.setDiffGasOpenPercentRangeF40_mileage(ints[1]);
            rangeDiffGasOpenPercentStatisticsData.setDiffGasOpenPercentRangeF30_mileage(ints[2]);
            rangeDiffGasOpenPercentStatisticsData.setDiffGasOpenPercentRangeF20_mileage(ints[3]);
            rangeDiffGasOpenPercentStatisticsData.setDiffGasOpenPercentRangeF10_mileage(ints[4]);
            rangeDiffGasOpenPercentStatisticsData.setDiffGasOpenPercentRange0_mileage(ints[5]);
            rangeDiffGasOpenPercentStatisticsData.setDiffGasOpenPercentRangeEq0_mileage(ints[6]);
            rangeDiffGasOpenPercentStatisticsData.setDiffGasOpenPercentRange10_mileage(ints[7]);
            rangeDiffGasOpenPercentStatisticsData.setDiffGasOpenPercentRange20_mileage(ints[8]);
            rangeDiffGasOpenPercentStatisticsData.setDiffGasOpenPercentRange30_mileage(ints[9]);
            rangeDiffGasOpenPercentStatisticsData.setDiffGasOpenPercentRange40_mileage(ints[10]);
            rangeDiffGasOpenPercentStatisticsData.setDiffGasOpenPercentRange50_mileage(ints[11]);
            rangeDiffGasOpenPercentStatisticsData.setDiffGasOpenPercentRangeMax_mileage(ints[12]);


            ints = fixArrayData(totalFuel, new Integer[]{
                    rangeDiffGasOpenPercentStatisticsData.getDiffGasOpenPercentRangeF50_fuel(),
                    rangeDiffGasOpenPercentStatisticsData.getDiffGasOpenPercentRangeF40_fuel(),
                    rangeDiffGasOpenPercentStatisticsData.getDiffGasOpenPercentRangeF30_fuel(),
                    rangeDiffGasOpenPercentStatisticsData.getDiffGasOpenPercentRangeF20_fuel(),
                    rangeDiffGasOpenPercentStatisticsData.getDiffGasOpenPercentRangeF10_fuel(),
                    rangeDiffGasOpenPercentStatisticsData.getDiffGasOpenPercentRange0_fuel(),
                    rangeDiffGasOpenPercentStatisticsData.getDiffGasOpenPercentRangeEq0_fuel(),
                    rangeDiffGasOpenPercentStatisticsData.getDiffGasOpenPercentRange10_fuel(),
                    rangeDiffGasOpenPercentStatisticsData.getDiffGasOpenPercentRange20_fuel(),
                    rangeDiffGasOpenPercentStatisticsData.getDiffGasOpenPercentRange30_fuel(),
                    rangeDiffGasOpenPercentStatisticsData.getDiffGasOpenPercentRange40_fuel(),
                    rangeDiffGasOpenPercentStatisticsData.getDiffGasOpenPercentRange50_fuel(),
                    rangeDiffGasOpenPercentStatisticsData.getDiffGasOpenPercentRangeMax_fuel()
            });
            rangeDiffGasOpenPercentStatisticsData.setDiffGasOpenPercentRangeF50_fuel(ints[0]);
            rangeDiffGasOpenPercentStatisticsData.setDiffGasOpenPercentRangeF40_fuel(ints[1]);
            rangeDiffGasOpenPercentStatisticsData.setDiffGasOpenPercentRangeF30_fuel(ints[2]);
            rangeDiffGasOpenPercentStatisticsData.setDiffGasOpenPercentRangeF20_fuel(ints[3]);
            rangeDiffGasOpenPercentStatisticsData.setDiffGasOpenPercentRangeF10_fuel(ints[4]);
            rangeDiffGasOpenPercentStatisticsData.setDiffGasOpenPercentRange0_fuel(ints[5]);
            rangeDiffGasOpenPercentStatisticsData.setDiffGasOpenPercentRangeEq0_fuel(ints[6]);
            rangeDiffGasOpenPercentStatisticsData.setDiffGasOpenPercentRange10_fuel(ints[7]);
            rangeDiffGasOpenPercentStatisticsData.setDiffGasOpenPercentRange20_fuel(ints[8]);
            rangeDiffGasOpenPercentStatisticsData.setDiffGasOpenPercentRange30_fuel(ints[9]);
            rangeDiffGasOpenPercentStatisticsData.setDiffGasOpenPercentRange40_fuel(ints[10]);
            rangeDiffGasOpenPercentStatisticsData.setDiffGasOpenPercentRange50_fuel(ints[11]);
            rangeDiffGasOpenPercentStatisticsData.setDiffGasOpenPercentRangeMax_fuel(ints[12]);


            ints = fixArrayData(totalDuration, new Integer[]{
                    rangeDiffGasOpenPercentStatisticsData.getDiffGasOpenPercentRangeF50_duration(),
                    rangeDiffGasOpenPercentStatisticsData.getDiffGasOpenPercentRangeF40_duration(),
                    rangeDiffGasOpenPercentStatisticsData.getDiffGasOpenPercentRangeF30_duration(),
                    rangeDiffGasOpenPercentStatisticsData.getDiffGasOpenPercentRangeF20_duration(),
                    rangeDiffGasOpenPercentStatisticsData.getDiffGasOpenPercentRangeF10_duration(),
                    rangeDiffGasOpenPercentStatisticsData.getDiffGasOpenPercentRange0_duration(),
                    rangeDiffGasOpenPercentStatisticsData.getDiffGasOpenPercentRangeEq0_duration(),
                    rangeDiffGasOpenPercentStatisticsData.getDiffGasOpenPercentRange10_duration(),
                    rangeDiffGasOpenPercentStatisticsData.getDiffGasOpenPercentRange20_duration(),
                    rangeDiffGasOpenPercentStatisticsData.getDiffGasOpenPercentRange30_duration(),
                    rangeDiffGasOpenPercentStatisticsData.getDiffGasOpenPercentRange40_duration(),
                    rangeDiffGasOpenPercentStatisticsData.getDiffGasOpenPercentRange50_duration(),
                    rangeDiffGasOpenPercentStatisticsData.getDiffGasOpenPercentRangeMax_duration()
            });
            rangeDiffGasOpenPercentStatisticsData.setDiffGasOpenPercentRangeF50_duration(ints[0]);
            rangeDiffGasOpenPercentStatisticsData.setDiffGasOpenPercentRangeF40_duration(ints[1]);
            rangeDiffGasOpenPercentStatisticsData.setDiffGasOpenPercentRangeF30_duration(ints[2]);
            rangeDiffGasOpenPercentStatisticsData.setDiffGasOpenPercentRangeF20_duration(ints[3]);
            rangeDiffGasOpenPercentStatisticsData.setDiffGasOpenPercentRangeF10_duration(ints[4]);
            rangeDiffGasOpenPercentStatisticsData.setDiffGasOpenPercentRange0_duration(ints[5]);
            rangeDiffGasOpenPercentStatisticsData.setDiffGasOpenPercentRangeEq0_duration(ints[6]);
            rangeDiffGasOpenPercentStatisticsData.setDiffGasOpenPercentRange10_duration(ints[7]);
            rangeDiffGasOpenPercentStatisticsData.setDiffGasOpenPercentRange20_duration(ints[8]);
            rangeDiffGasOpenPercentStatisticsData.setDiffGasOpenPercentRange30_duration(ints[9]);
            rangeDiffGasOpenPercentStatisticsData.setDiffGasOpenPercentRange40_duration(ints[10]);
            rangeDiffGasOpenPercentStatisticsData.setDiffGasOpenPercentRange50_duration(ints[11]);
            rangeDiffGasOpenPercentStatisticsData.setDiffGasOpenPercentRangeMax_duration(ints[12]);

        }else{
            statisticData.setRangeDiffGasOpenPercentStatisticsData(new RangeDiffGasOpenPercentStatisticsData());
        }

        //加速度区间
        RangeAcceleratedSpeedStatisticsData rangeAcceleratedSpeedStatisticsData = statisticData.getRangeAcceleratedSpeedStatisticsData();
        if(null != rangeAcceleratedSpeedStatisticsData){
            ints = fixArrayData(totalMileage, new Integer[]{
                    rangeAcceleratedSpeedStatisticsData.getAcceleratedSpeedRangeF1_mileage(),
                    rangeAcceleratedSpeedStatisticsData.getAcceleratedSpeedRangeF07_mileage(),
                    rangeAcceleratedSpeedStatisticsData.getAcceleratedSpeedRangeF05_mileage(),
                    rangeAcceleratedSpeedStatisticsData.getAcceleratedSpeedRangeF03_mileage(),
                    rangeAcceleratedSpeedStatisticsData.getAcceleratedSpeedRangeF01_mileage(),
                    rangeAcceleratedSpeedStatisticsData.getAcceleratedSpeedRange0_mileage(),
                    rangeAcceleratedSpeedStatisticsData.getAcceleratedSpeedRangeEq0_mileage(),
                    rangeAcceleratedSpeedStatisticsData.getAcceleratedSpeedRange01_mileage(),
                    rangeAcceleratedSpeedStatisticsData.getAcceleratedSpeedRange03_mileage(),
                    rangeAcceleratedSpeedStatisticsData.getAcceleratedSpeedRange05_mileage(),
                    rangeAcceleratedSpeedStatisticsData.getAcceleratedSpeedRange07_mileage(),
                    rangeAcceleratedSpeedStatisticsData.getAcceleratedSpeedRange1_mileage(),
                    rangeAcceleratedSpeedStatisticsData.getAcceleratedSpeedRangeMax_mileage()
            });
            rangeAcceleratedSpeedStatisticsData.setAcceleratedSpeedRangeF1_mileage(ints[0]);
            rangeAcceleratedSpeedStatisticsData.setAcceleratedSpeedRangeF07_mileage(ints[1]);
            rangeAcceleratedSpeedStatisticsData.setAcceleratedSpeedRangeF05_mileage(ints[2]);
            rangeAcceleratedSpeedStatisticsData.setAcceleratedSpeedRangeF03_mileage(ints[3]);
            rangeAcceleratedSpeedStatisticsData.setAcceleratedSpeedRangeF01_mileage(ints[4]);
            rangeAcceleratedSpeedStatisticsData.setAcceleratedSpeedRange0_mileage(ints[5]);
            rangeAcceleratedSpeedStatisticsData.setAcceleratedSpeedRangeEq0_mileage(ints[6]);
            rangeAcceleratedSpeedStatisticsData.setAcceleratedSpeedRange01_mileage(ints[7]);
            rangeAcceleratedSpeedStatisticsData.setAcceleratedSpeedRange03_mileage(ints[8]);
            rangeAcceleratedSpeedStatisticsData.setAcceleratedSpeedRange05_mileage(ints[9]);
            rangeAcceleratedSpeedStatisticsData.setAcceleratedSpeedRange07_mileage(ints[10]);
            rangeAcceleratedSpeedStatisticsData.setAcceleratedSpeedRange1_mileage(ints[11]);
            rangeAcceleratedSpeedStatisticsData.setAcceleratedSpeedRangeMax_mileage(ints[12]);

            ints = fixArrayData(totalFuel, new Integer[]{
                    rangeAcceleratedSpeedStatisticsData.getAcceleratedSpeedRangeF1_fuel(),
                    rangeAcceleratedSpeedStatisticsData.getAcceleratedSpeedRangeF07_fuel(),
                    rangeAcceleratedSpeedStatisticsData.getAcceleratedSpeedRangeF05_fuel(),
                    rangeAcceleratedSpeedStatisticsData.getAcceleratedSpeedRangeF03_fuel(),
                    rangeAcceleratedSpeedStatisticsData.getAcceleratedSpeedRangeF01_fuel(),
                    rangeAcceleratedSpeedStatisticsData.getAcceleratedSpeedRange0_fuel(),
                    rangeAcceleratedSpeedStatisticsData.getAcceleratedSpeedRangeEq0_fuel(),
                    rangeAcceleratedSpeedStatisticsData.getAcceleratedSpeedRange01_fuel(),
                    rangeAcceleratedSpeedStatisticsData.getAcceleratedSpeedRange03_fuel(),
                    rangeAcceleratedSpeedStatisticsData.getAcceleratedSpeedRange05_fuel(),
                    rangeAcceleratedSpeedStatisticsData.getAcceleratedSpeedRange07_fuel(),
                    rangeAcceleratedSpeedStatisticsData.getAcceleratedSpeedRange1_fuel(),
                    rangeAcceleratedSpeedStatisticsData.getAcceleratedSpeedRangeMax_fuel()
            });
            rangeAcceleratedSpeedStatisticsData.setAcceleratedSpeedRangeF1_fuel(ints[0]);
            rangeAcceleratedSpeedStatisticsData.setAcceleratedSpeedRangeF07_fuel(ints[1]);
            rangeAcceleratedSpeedStatisticsData.setAcceleratedSpeedRangeF05_fuel(ints[2]);
            rangeAcceleratedSpeedStatisticsData.setAcceleratedSpeedRangeF03_fuel(ints[3]);
            rangeAcceleratedSpeedStatisticsData.setAcceleratedSpeedRangeF01_fuel(ints[4]);
            rangeAcceleratedSpeedStatisticsData.setAcceleratedSpeedRange0_fuel(ints[5]);
            rangeAcceleratedSpeedStatisticsData.setAcceleratedSpeedRangeEq0_fuel(ints[6]);
            rangeAcceleratedSpeedStatisticsData.setAcceleratedSpeedRange01_fuel(ints[7]);
            rangeAcceleratedSpeedStatisticsData.setAcceleratedSpeedRange03_fuel(ints[8]);
            rangeAcceleratedSpeedStatisticsData.setAcceleratedSpeedRange05_fuel(ints[9]);
            rangeAcceleratedSpeedStatisticsData.setAcceleratedSpeedRange07_fuel(ints[10]);
            rangeAcceleratedSpeedStatisticsData.setAcceleratedSpeedRange1_fuel(ints[11]);
            rangeAcceleratedSpeedStatisticsData.setAcceleratedSpeedRangeMax_fuel(ints[12]);
            ints = fixArrayData(totalDuration, new Integer[]{
                    rangeAcceleratedSpeedStatisticsData.getAcceleratedSpeedRangeF1_duration(),
                    rangeAcceleratedSpeedStatisticsData.getAcceleratedSpeedRangeF07_duration(),
                    rangeAcceleratedSpeedStatisticsData.getAcceleratedSpeedRangeF05_duration(),
                    rangeAcceleratedSpeedStatisticsData.getAcceleratedSpeedRangeF03_duration(),
                    rangeAcceleratedSpeedStatisticsData.getAcceleratedSpeedRangeF01_duration(),
                    rangeAcceleratedSpeedStatisticsData.getAcceleratedSpeedRange0_duration(),
                    rangeAcceleratedSpeedStatisticsData.getAcceleratedSpeedRangeEq0_duration(),
                    rangeAcceleratedSpeedStatisticsData.getAcceleratedSpeedRange01_duration(),
                    rangeAcceleratedSpeedStatisticsData.getAcceleratedSpeedRange03_duration(),
                    rangeAcceleratedSpeedStatisticsData.getAcceleratedSpeedRange05_duration(),
                    rangeAcceleratedSpeedStatisticsData.getAcceleratedSpeedRange07_duration(),
                    rangeAcceleratedSpeedStatisticsData.getAcceleratedSpeedRange1_duration(),
                    rangeAcceleratedSpeedStatisticsData.getAcceleratedSpeedRangeMax_duration()
            });
            rangeAcceleratedSpeedStatisticsData.setAcceleratedSpeedRangeF1_duration(ints[0]);
            rangeAcceleratedSpeedStatisticsData.setAcceleratedSpeedRangeF07_duration(ints[1]);
            rangeAcceleratedSpeedStatisticsData.setAcceleratedSpeedRangeF05_duration(ints[2]);
            rangeAcceleratedSpeedStatisticsData.setAcceleratedSpeedRangeF03_duration(ints[3]);
            rangeAcceleratedSpeedStatisticsData.setAcceleratedSpeedRangeF01_duration(ints[4]);
            rangeAcceleratedSpeedStatisticsData.setAcceleratedSpeedRange0_duration(ints[5]);
            rangeAcceleratedSpeedStatisticsData.setAcceleratedSpeedRangeEq0_duration(ints[6]);
            rangeAcceleratedSpeedStatisticsData.setAcceleratedSpeedRange01_duration(ints[7]);
            rangeAcceleratedSpeedStatisticsData.setAcceleratedSpeedRange03_duration(ints[8]);
            rangeAcceleratedSpeedStatisticsData.setAcceleratedSpeedRange05_duration(ints[9]);
            rangeAcceleratedSpeedStatisticsData.setAcceleratedSpeedRange07_duration(ints[10]);
            rangeAcceleratedSpeedStatisticsData.setAcceleratedSpeedRange1_duration(ints[11]);
            rangeAcceleratedSpeedStatisticsData.setAcceleratedSpeedRangeMax_duration(ints[12]);
        }else{
            statisticData.setRangeAcceleratedSpeedStatisticsData(new RangeAcceleratedSpeedStatisticsData());
        }
        //急减速里程
        statisticData.setSharpDeceleration(fixSingleData(totalMileage0,totalMileage,statisticData.getSharpDownSpeedNumber()));



    }

    /**
     * 获取精准计算后的精准数据数组
     * @param correctTotal 精准的总数
     * @param orgValue     原始数据的数组
     * @return
     */
    public static Integer[] fixArrayData(int correctTotal, Integer[] orgValue) {
        //原始数据累加
        int beforeCorrectSum=0;
        boolean hasValue=false;

        //计算原始数据的累加值
        for(Integer item : orgValue){
            if(item !=null){
                int in = item;
                if(in>=0){
                    beforeCorrectSum += in;
                }
                hasValue=true;
            }
        }

        if(hasValue && beforeCorrectSum>=0){
            //精准后的数据累加
            int afterCorrect = 0;

            //精准后的数据数组
            Integer[] ints = new Integer[orgValue.length];

            for(int i=0; i<orgValue.length; i++){
                Integer item = orgValue[i];
                int in = null!=item ? item : 0;
                if(beforeCorrectSum >0 ) {
                    //原始数据占总原始数据和的比例 * 精准的总和
                    ints[i] = BigDecimal.valueOf(in).divide(BigDecimal.valueOf(beforeCorrectSum), 6, BigDecimal.ROUND_DOWN)
                            .multiply(BigDecimal.valueOf(correctTotal)).setScale(0, BigDecimal.ROUND_DOWN).intValue();
                }else{
                    ints[i]=0;
                }
                afterCorrect += ints[i];
            }

            //找出最大值的区间index
            int maxValue = ints[0];
            int lastFixtIdx=0;
            for(int i=1; i<ints.length; i++){
                if(maxValue < ints[i]){
                    maxValue = ints[i];
                    lastFixtIdx = i;
                }
            }

            //保证总数完全能对上
            ints[lastFixtIdx] = ints[lastFixtIdx] + (correctTotal - afterCorrect);
            if(ints[lastFixtIdx] <0 ){
                ints[lastFixtIdx] = 0;
            }

            return ints;
        }else{
            return orgValue;
        }
    }


    /**
     * 获取原始值对应的精准值
     * @param orgTotal  原始总和
     * @param correctTotal 精准总和
     * @param orgValue     原始值
     * @return
     */
    private static Integer fixSingleData(int orgTotal, int correctTotal, Integer orgValue) {
        if (orgValue == null ) {
            return null;
        }
        if (orgTotal == correctTotal) {
            return orgValue;
        }
        if (orgTotal <= 0) {
            return 0;
        }

        return (int) ( (1.0 * orgValue / orgTotal) * correctTotal );
    }

    /**
     * 精准区间值
     * @param totalMileage
     * @param totalFuel
     * @param totalDuration
     * @param altitudeRanges
     */
    private static void fixRangeData(int totalMileage, int totalFuel, int totalDuration, Map<Integer, InterRangeData> altitudeRanges) {
        if (altitudeRanges != null && altitudeRanges.size() > 0) {
            Integer[] fuels = new Integer[altitudeRanges.size()];
            Integer[] mileages = new Integer[altitudeRanges.size()];
            Integer[] durations = new Integer[altitudeRanges.size()];
            Integer[] indexs = new Integer[altitudeRanges.size()];

            int i = 0;
            for (Map.Entry<Integer, InterRangeData> entry : altitudeRanges.entrySet()) {
                indexs[i] = entry.getKey();
                InterRangeData data = entry.getValue();
                fuels[i] = data.getFuel();
                mileages[i] = data.getMileage();
                durations[i] = data.getTime();
                i++;
            }

            Integer[] intFuels = fixArrayData(totalFuel, fuels);
            Integer[] intMileages = fixArrayData(totalMileage,mileages);
            Integer[] intDurations = fixArrayData(totalDuration, durations);
            i=0;
            for(int idx : indexs){
                InterRangeData data=altitudeRanges.get(idx);
                data.setFuel(intFuels[i]);
                data.setMileage(intMileages[i]);
                data.setTime(intDurations[i]);
                i++;
            }
        }
    }

}
